<template>
  <div class="order-detail-page" v-if="order">
    <!-- 操作栏 -->
    <DetailAction :order="order"/>
    <!-- 步骤条 组件xtx-steps.vue-->
    <DetailSteps :order="order"/>
    <!-- 物流栏 -->
    <Suspense v-if="[3,4,5].includes(order.orderState)">
      <template #default >
        <DetailLogistics  :order="order"/>
      </template>
      <template #fallback>
        loading...
      </template>
    </Suspense>
    <!-- 订单商品信息 -->
    <OrderInfo :order="order"/>
  </div>
</template>
<script>
import { ref } from 'vue-demi'
import DetailAction from './components/detail-action'
import { findOrder } from '@/api/order'
import { useRoute } from 'vue-router'
import DetailSteps from './components/detail-steps.vue'
import DetailLogistics from './components/detail-logistics.vue'
import OrderInfo from './components/order-info.vue'
export default {
  name: 'MemberOrderDetail',
  components: { DetailAction, DetailSteps, DetailLogistics, OrderInfo },
  setup () {
    const route = useRoute()
    const order = ref(null)
    findOrder(route.params.id).then(res => {
      order.value = res.result
    })
    return { order }
  }
}
</script>
<style scoped lang="less">
.order-detail-page {
  background: #fff;
}
</style>
